<template>
    <el-container>
      <el-aside width="auto">
         <el-menu
          :collapse="isCollapse"
          default-active="this.$route.path"
          router
          class="el-menu-vertical-demo"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b">
          <el-menu-item :index="item.path" v-for="item in asidemenu1" :key="item.path">
            <i class="el-icon-s-home"></i>
            <span slot="title">首页</span>
          </el-menu-item>
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-location"></i>
              <span>活动管理</span>
            </template>
            <el-menu-item-group>
<!--               <template slot="title">活动</template> -->
              <el-menu-item :index="item.path" v-for="item in asidemenu2" :key="item.path" style="text-align: center; font-size: 16px;">{{item.title}}</el-menu-item>
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-header>
          <div>
            <el-button type="primary" icon="el-icon-menu" @click="isCollapse = !isCollapse"></el-button>
          </div>
          <div>
            <el-dropdown>
              <span class="el-dropdown-link">
                <el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" :fit="fits"></el-avatar>
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>退出</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
        </el-header>
        <el-main>
          <router-view/>
        </el-main>
      </el-container>
    </el-container>
</template>

<script>
export default {
  name: 'Admin',
  data() {
    return {
      isCollapse: true,
      fits: 'contains',
      asidemenu1: [{
        path: '/adminhome',
        name: 'adminhome'
      }],
      asidemenu2: [{
        path: '/admincategory',
        name: 'admincategory',
        title: '活动性质'
      },{
        path: '/admincontent',
        name: 'admincontent',
        title: '活动内容'
      }]
    }
  },
  methods: {
  }
}
</script>

<style scoped>
  .el-container {
    height: 100%;
  }
  .el-menu {
    height: 100%;
    border: none;
  }
  .el-header {
    background-color: black;
    display: flex;
    align-items: center;
    height: 100%;
    justify-content: space-between;
  }
  .el-menu-vertical-demo:not(.el-menu--collapse) {
    width: 200px;
    min-height: 400px;
  }
  .el-dropdown-link {
    cursor: pointer;
    color: #409EFF;
  }
  .el-icon-arrow-down {
    font-size: 12px;
  }
</style>